package com.vision.listener;

import jakarta.servlet.ServletRequestEvent;
import jakarta.servlet.ServletRequestListener;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

@Component
public class RequestListener implements ServletRequestListener {

    // 在请求销毁之前进行调用（Controller方法调用之后）
    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        // 将所有 request 请求都携带上 httpSession
        ((HttpServletRequest) sre.getServletRequest()).getSession();
    }
}
